<template>
  <div>
    <ul>
      <li v-for="(item,index) in arr" :key="index">
        <span>{{item}}</span>
        <button @click="remove(index)">删除</button>
      </li>
    </ul>
    <button @click="generate">生成</button>
  </div>
</template>

<script>
export default {
  data(){
    return {
      arr: [1, 5, 3]
    }
  },
  methods: {
    remove(index) {
      this.arr.splice(index, 1)
    },
    generate(){
      this.arr.push(Math.floor(Math.random() * (10 - 5 + 1) + 5));
    }
  }
}
</script>

<style>

</style>